package com.vgemv.jsutilitysdkdemo.module.List.Chat;

import android.graphics.Color;

import com.vgemv.jsutilitysdk.geometry.JsGeometryManager;
import com.vgemv.jsutilitysdk.Menu.JsMenuView.JsMenuItemVm.JsMenuItemVm;

public class ChatItemViewVm extends JsMenuItemVm {


    public static int headerImageViewSize  = 120;
    public static int headerImageViewTopPadding = 15;
    public static int headerImageViewLeftPadding = 60;
    public static int headerImageViewContentSpacing = 60;

    public static int contentRightPadding = 60;
    public static int contentBottomPadding = 30;

    public static int timeTopPadding = 30;

    public static int authorTextSize = 12;
    public static int contentTextSize = 15;

    public static int contextCornerRadius = 15;

    public static int timeTextColor = Color.argb(255,160,160,160);

    //内容宽度,需要根据内容计算出来.
    public int contextWidth = 0;
    public int timeRightPadding = 0;

    private ChatModel _model;

    public void setModel(ChatModel model) {
        _model = model;

        //计算内容的宽度
        String content = model.discussContent;
        int width = JsGeometryManager.getOneLineTextWidth(content,ChatItemViewVm.contentTextSize);
        int maxWidth = JsGeometryManager.getScreenSizeInPixel().getWidth() - headerImageViewLeftPadding - headerImageViewSize - headerImageViewContentSpacing - contentRightPadding;
        contextWidth = Math.min(maxWidth,width);
        timeRightPadding = JsGeometryManager.getScreenSizeInPixel().getWidth() - contextWidth - headerImageViewLeftPadding - headerImageViewSize - headerImageViewContentSpacing;
    }

    public ChatModel getModel() {
        return _model;
    }


    public ChatItemViewVm() {
        super(1);
        getUnselectedStyle().mi_cornerRadius = 0;
    }
}
